package com.boodaba.todocarts.test.app;

import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;

import com.boodaba.todocarts.domain.Label;


public class IdenticalLabelMatcher extends TypeSafeMatcher<Label> {

	 private Label mLabel;

	public IdenticalLabelMatcher(Label label) {
		 mLabel = label;
	 }
	
	@Override
	public void describeTo(Description description) {
		description.appendText("Label's title is " + mLabel.getTitle());		
	}

	@Override
	public boolean matchesSafely(Label item) {
		return mLabel.identicalTo(item);
	}
	
	@Factory
	public static Matcher<Label> aLabelIdenticalWith(Label label) {
	    return new IdenticalLabelMatcher(label);
	}

}
